﻿<?php
/**
 * Classe Db da tabela TB_PARAM_SEXO
 * 
 * @author			Mário R. Castro
 * @copyright		Voitech Sistema
 * @package			SEMAS
 * @subpackage		semas.application.models.Db
 * @version			1.0
*/
class App_Model_Db_ParamSexo extends Voitech_Db{

	protected $_name 		= 'tb_param_sexo';
    protected $_primary 	= 'co_sexo';
	
	static private $instancia;

	/**
	 * @return App_Model_Db_ParamSexo
	 */
	static public function build() {
		if( !isset( self::$instancia ) ) {
			$classe = __CLASS__;
			self::$instancia = new $classe();
		}
		return self::$instancia;
	}
	
	public function listarTodos(Voitech_TO $obTO=null){
            $obSelect =  $this->getAdapter()->select()
                                       ->from(array('tb_param_sexo'=>'tb_param_sexo'))
                                       ->columns(array(
                                       					'*'
                                                  ));   

            if( !empty( $obTO->co_sexo ) ) {
                $obSelect->where('co_sexo =?', $obTO->co_sexo);
            }
            //var_dump($obSelect->assemble());exit;
            return $this->getAdapter()->fetchAll($obSelect);			   						   
	}	
	
}